<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/9/23/023
  Time: 19:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <form:form action="${pageContext.request.contextPath}/emp" method="post" modelAttribute="employee">


        <c:if test="${employee.id==null}">
        lastName: <form:input path="lastName"></form:input><form:errors path="lastName"></form:errors>
        </c:if>
        <c:if test="${employee.id!=null}">
            <form:hidden path="id"></form:hidden>
        </c:if>
        <br>
        email: <form:input path="email"/><br><form:errors path="email"></form:errors>
        <%
            Map<String, String> genders = new HashMap();
            genders.put("1", "Male");
            genders.put("0", "Female");
            request.setAttribute("genders", genders);
        %>
        Gender:
        <br>
        <form:radiobuttons path="gender" items="${genders }" delimiter="<br>"/>
        <br>
        Department: <form:select path="department.id" items="${requestScope.departments}" itemLabel="departmentName" itemValue="id"></form:select>
        brith: <form:input path="brith"></form:input><form:errors path="brith"></form:errors>

        <input type="submit" value="submit"/>
    </form:form>
</body>
</html>
